home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Disc to the Future 2
/
Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin
/
MAC
/
THINKC
/
4_0
/
DNA_XCMD
/
BASECOMP.C
next >
Wrap
Text File
|
1991-08-31
|
2KB
|
94 lines
/* BaseComp.c
Reece Hart
Molecular Genetics Laboratory, The Salk Institute
Division of Biology & Dept. of Comp. Sci, Washington University
America OnLine: Reece Internet: reece@informatics.wustl.edu
Modification History
╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
90 Nov 10 Original coding.
91 Aug 30 Augmented list of mapped codes to include keto/amino for
completeness.
*/
#include "BaseComp.h"
/* ******************************************************************************
BaseCompliment()
This function returns the complimentary base (type 'char') according to
Watson-Crick pairing (A - T, C - G), purine/pyrimidine pairing (A,G - C,T),
and amino/keto (A,C - G,T) pairing.
Watson-Crick:
A -> T a -> t adenine -> thymine
T -> A t -> a thymine -> adenine
C -> G c -> g cytosine -> guanine
G -> C G -> c guaning -> cytosine
Purine/Pyrimidine:
R -> Y r -> y purine -> pyrimidine
Y -> R y -> r pyrimidine -> purine
Amino/Keto:
K -> M k -> m keto -> amino
M -> K m -> k amino -> keto
All other values, including the IUPAC 'N' code for unknown bases, are
returned unchanged.
****************************************************************************** */
char BaseCompliment(char Base)
{
/* A switch-case setup seemed to be the fastest, although less elegant
than other solutions */
switch (Base)
{
/* Primary bases */
case 'A':
return 'T';
case 'a':
return 't';
case 'C':
return 'G';
case 'c':
return 'g';
case 'G':
return 'C';
case 'g':
return 'c';
case 'T':
return 'A';
case 't':
return 'a';
/* Purine/Pyrimidine pairing */
case 'R':
return 'Y';
case 'r':
return 'y';
case 'Y':
return 'R';
case 'y':
return 'r';
/* Amino/Keto pairing */
case 'M':
return 'K';
case 'm':
return 'k';
case 'K':
return 'M';
case 'k':
return 'm';
/* Undefined symbol╔ return it unmapped */
default:
return Base;
}
}